package com.qidian.mes.cal.controller;

import com.qidian.mes.cal.service.UserService;
import com.qidian.mes.pojo.User;
import com.qidian.mes.util.pojo.MESResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@CrossOrigin
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService;

    @GetMapping("/getByUserId")
    //根据用户id查询数据
    public MESResult getByUserId(Long userId) {
        return userService.getByUserId(userId);
    }

    @GetMapping("/selectByDepartmentId")
    //根据部门id查询用户数据
    public MESResult selectByDepartmentId(Long departmentId) {
        return userService.selectByDepartmentId(departmentId);
    }

    @GetMapping("/list")
    //分页查询
    public MESResult list(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = " 10") int limit, User user) {
        return userService.list(page,limit,user);
    }

}
